<cfset change_password = 'No'>
<cfset waserror = 0>

<cfif len(trim(form.newpassword)) GT 0>
	<cfif NOT form.newpassword IS form.newpassword_confirm>
        <div id="messages_error">Password and confirmation password did not match.  User password was not updated.</div>
		<cfset waserror = 1>
	<cfelse>
    	<cfset change_password = 'Yes'>
	</cfif>
</cfif>

<!---encryp password--->
<cfif change_password IS 'Yes'>
	<cfinvoke component="cfcs.common.encryption" method="encryptstring" textstring="#form.newpassword#" returnvariable="enc_password">
</cfif>

<cfif waserror IS 0>
    <cfquery name = "UpdateUser" datasource="#request.dsn#">
    UPDATE core_admins
    SET <cfif change_password IS 'yes'>pword='#enc_password#', </cfif>
    userlevel='#form.userlevel#',
    fullname = '#form.fullname#',
    emailaddress = '#form.emailaddress#',
    userid = '0'
    WHERE id = #form.id#
    </cfquery>
	
    <div id="messages">User information was updated.</div>

</cfif>
